<template>
	<view class="zone">
		<Header title="获奖名单"></Header>
		<view class="main">
			<image class="yun" src="http://image.qxgm.site/tdz/img/public/m_yun.png" mode="widthFix"></image>
			<image class="ping1" src="http://image.qxgm.site/tdz/img/public/ping1.png" mode="widthFix"></image>

			<view class="box">
				<view class="staname">
					<view class="name1">
						头像
					</view>
					<view class="name2">
						昵称/期数
					</view>
					<view class="name2">
						获奖物品
					</view>
				</view>

				<scroll-view scroll-y class="scrollbox" @scrolltolower="scrolltolower">
					<view class="item" v-for="(item , index) in listdata" :key="index">
						<image class="header" :src="item.avatar" mode="widthFix"></image>
						<view class="ybox">
							<view class="name">
								{{item.username}}
							</view>
							<view class="sind">
								{{item.remark}}
							</view>
						</view>
						<view class="right">
							<image :src="item.props.img" mode="widthFix"></image>
						</view>
					</view>

					<view class="empty" v-if="listdata == ''">
						<image src="http://img.cpgm.cc/xfmz/static/public/empty.png" mode="widthFix" />
						<text class="hui">
							没有数据哦~
						</text>
					</view>
					<u-loadmore v-else :status="status" color="#666" :icon-type="iconType" :load-text="loadText" />
				</scroll-view>
			</view>


		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				listdata: [],
				page: 1,
				max_page: 1,
				status: 'loadmore',
				iconType: 'flower',
				loadText: {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '没有更多了'
				},
                userinfo:{}
			}
		},
		onShow() {

		},
		onLoad() {
			this.rewardlogs()
		},
		methods: {

			scrolltolower() {
				if (this.page >= this.max_page) {
					this.status = 'nomore'
					return;
				}
				this.status = 'loading';
				this.page = ++this.page;
				this.rewardlogs();
				setTimeout(() => {
					if (this.page > this.max_page || this.page == this.max_page) this.status = 'nomore';
					else this.status = 'loading';
				}, 500)
			},
			// 好友记录
			async rewardlogs() {
				let res = await this.$http.index.rewardlogs({
					page: this.page
				})
				if (res.code == 1) {
					this.max_page = res.data.last_page
					this.listdata = [...this.listdata, ...res.data.data]
					if (this.page > this.max_page || this.page == this.max_page) this.status = 'nomore';
				}
			},
		}
	}
</script>

<style lang="less">
	.zone {
		min-height: 100vh;
		background: url(http://image.qxgm.site/tdz/img/public/p_bg.png) no-repeat;
		background-size: 100% auto;
	}

	.main {
		width: 100%;
		position: relative;
		margin-top: 10px;
	}

	.yun {
		position: absolute;
		top: -3%;
		left: 0;
		width: 44%;
		z-index: 9;
	}

	.box {
		background: url(http://image.qxgm.site/tdz/img/public/ping2.png);
		background-size: 100% auto;
		padding: 10px 6px 0;
	}

	.scrollbox {
		height: calc(100vh - 152px);
		overflow-y: scroll;
	}

	.ping1 {
		width: 100%;
		display: flex;
	}

	.title {
		display: flex;
		align-items: center;
		justify-content: center;
		background: url(http://image.qxgm.site/tdz/img/xianyu/mg-05.png) no-repeat;
		background-size: 100% 100%;
		padding: 0px 0 18px;

		image {
			width: 18%;
		}

		text {
			font-size: 20px;
			font-weight: normal;
			color: #50463E;
			line-height: 20px;
			margin: 0 13px;
		}
	}

	.item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		background: url(http://image.qxgm.site/tdz/img/xianyu/mg-06.png) no-repeat;
		background-size: 100% 100%;
		margin-bottom: 2px;
		padding: 13px 9px;
		box-sizing: border-box;
	}


	.header {
		width: 47px;
        border-radius: 50%;
	}

	.name {
		font-size: 14px;
		font-weight: normal;
		color: #333333;
		line-height: 14px;
		margin-bottom: 9px;
		white-space: nowrap;
		/*不允许换行*/
		overflow: hidden;
		/*超出隐藏*/
		text-overflow: ellipsis;
	}

	.ybox {
		flex: 1;
		margin-left: 4px;
		width: 0%;
	}

	.sind {
		font-size: 14px;
		font-weight: normal;
		color: #333333;
		line-height: 14px;
	}

	.right {
		width: 15%;

		image {
			width: 100%;
			background: url(http://image.qxgm.site/tdz/img/duobao/kuang.png) no-repeat;
			background-size: 100% 100%;
		}
	}


	.staname {
		display: flex;
		align-items: center;
		justify-content: space-between;
		background: url(http://image.qxgm.site/tdz/img/rank/mg-11.png) no-repeat;
		background-size: 100% 100%;
		font-weight: normal;
		font-size: 15px;
		color: #333333;
		line-height: 15px;
		padding: 11px 10% 11px 2%;
		margin-bottom: 8px;
	}
</style>